package com.sphd.emanu.activity.generalaffairs;

import android.content.Context;

import com.sphd.emanu.mvp.BasePresenterImpl;
import com.sphd.emanu.pojo.login.User;
import com.sphd.emanu.utils.GsonUtil;
import com.wzutils.L;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class GeneralaffairsPresenter extends BasePresenterImpl<GeneralaffairsContract.View> implements GeneralaffairsContract.Presenter{

    @Override
    public void selectUser(Integer org) {
        emanuService.selectUser(org).enqueue(new Callback<String>() {
            @Override
            public void onResponse(Call<String> call, Response<String> response) {
                L.e(response.toString());
                List<User> userList= GsonUtil.jsonToList(response.body(),User.class);
                mView.setListBean(userList);
            }

            @Override
            public void onFailure(Call<String> call, Throwable t) {
                    Error(t);
            }
        });
    }
}
